>> TGS_phase_analysis('Cr_single_crystal-2019-06-27-06.40um-50degrees-POS-1.txt','Cr_single_crystal-2019-06-27-06.40um-50degrees-NEG-1.txt',6.4,1)

f2 = 

     General model:
     f2(x) = A.*(erfc(q*sqrt(k*(x+start_time)))-beta*exp(-q^2*k*(x+start_time)
                    )./sqrt((x+start_time)))+B.*sin(2*pi*(peak_freq)*(x+
                    start_time)+p)*exp(-(x+start_time)/t)+D
     Coefficients (with 95% confidence bounds):
       A =     0.01627  (0.01614, 0.01641)
       k =   2.783e-05  (2.74e-05, 2.827e-05)
       beta =   3.587e-09  (fixed at bound)
       B =    0.007656  (0.007538, 0.007774)
       p =      -2.416  (-2.427, -2.404)
       t =   2.092e-08  (2.043e-08, 2.141e-08)
       D =  -0.0001558  (-0.0001779, -0.0001337)
     Problem parameters:
       q =   9.817e+05
       start_time =       8e-10
       peak_freq =   5.483e+08
Bad fit for:Cr_single_crystal-2019-06-27-06.40um-50degrees-POS-1.txt~re: beta

ans =

   5.4831e+08